package org.example.dao.impl;

import org.example.dao.DictDao;
import org.example.tools.JDBCTool;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class DictDaoImpl implements DictDao {
    @Override
    public Map<String, String> getJobType() {
        Map<String, String> jobMap=new HashMap<>();
        try {
            Connection conn = JDBCTool.getConnection();
            String sql="select * from sys_dict where dict_type='job_type'";
            PreparedStatement ps =conn.prepareStatement(sql);
            ResultSet rs = ps.executeQuery();
            while(rs.next()){
                String key = rs.getString("dict_code");
                String value = rs.getString("dict_name");
                jobMap.put(key,value);
            }

        }catch (Exception e){
            e.printStackTrace();
        }

        return jobMap;
    }
}
